// LemCoop
// Copyright (C) 2013  Oliver Naumann <bldrax@gmail.com>

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef LEMC_GAMESTATE_H
#define LEMC_GAMESTATE_H

#include "WindowsIncludes.h"
#include <allegro5/allegro.h>

class GameEngine;

/*
* An abstract class for game states. Game states work in the following way: Either the main program
* or a game state have to create a new game state. Afterwards, it has to be initialized via 'Init()'
* in order to set all necessary parameters (so that one state can pass parameters to the next). If 
* everything is done, the gamestate needs to be registered using m_engine->SetNextState(). The game
* engine will then destroy the old state and start the new one.
*/
class GameState
{
protected:
	// A pointer to the game engine.
	GameEngine* m_engine;

public:

	/*
	* The contructor saves the pointer to the game engine.
	*/
	GameState(GameEngine* engine);

	/*
	* Handles the input.
	*/
	virtual void HandleInput(ALLEGRO_EVENT next_event) = 0;

	/*
	* Updates the game.
	*/
	virtual void Update(float timing_factor) = 0;

	/*
	* Draws the game.
	*/
	virtual void Draw() = 0;
};

#endif